﻿using System;
using System.Collections.Generic;
using UnityEngine;

namespace WentStateMachine
{
    [Serializable]
    public class Transition
    {
        public Condition[] conditions;

        [SerializeField] private int[] _destinationState;
        public int[] destinationState { 
            get {
                return _destinationState;
            }
            set {
                _destinationState = value;
            }
        }

        [SerializeField] private int[] _destinationStateMachine;
        public int[] destinationStateMachine
        {
            get
            {
                return _destinationStateMachine;
            }
            set
            {
                _destinationStateMachine = value;
            }
        }

        public void AddCondtion(ConditionMode mode, float threshold, string parameter)
        {
            List<Condition> tmp = new List<Condition>(conditions);
            var con = new Condition()
            {
                mode = mode,
                threshold = threshold,
                parameter = parameter
            };
            tmp.Add(con);
            conditions = tmp.ToArray();
        }

        public void RemoveCondition(Condition condition)
        {
            List<Condition> tmp = new List<Condition>(conditions);
            tmp.Remove(condition);
            conditions = tmp.ToArray();
        }
    }
}
